package com.jgsu.farm.service.impl;

import com.jgsu.farm.entity.User;
import com.jgsu.farm.exception.DataMatchException;
import com.jgsu.farm.mapper.AdminMapper;
import com.jgsu.farm.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @program: farm-10-14-2019
 * @description: 管理员的实现类
 * @author: Mr.zuo
 * @create: 2019-12-05 16:41
 **/
@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    AdminMapper adminMapper;

    @Override
    public User loginSysUser(String phone, String password,Integer role) {
            // role：1，直接刷选初管理员
            User sysUser = adminMapper.loginSysUser(phone, password, role);
             if (sysUser == null){
                 throw new DataMatchException("405","用户名或密码错误");
             }
             return sysUser;
    }
}
